package com.paypalpay.service;

import com.paypalpay.entity.common.UserboundPaymentOrder;
import com.paypalpay.entity.pay.PaypalNotificationpaymentResults;

import java.util.List;

public interface UserboundPaymentOrderService {

    //插入数据：此时是微信公众号访问的无卡购买流程
    public void insertWeixinNoCardInfo(UserboundPaymentOrder user);

    //查询数据：是否存在当前用户
    public int findExistOrNot(String deviceId, String openId);

    //查询数据：是否存在当前用户，此时orderId为null和空
    public int findExistOrNotByOrderId(String deviceId, String openId);

    //插入数据：此时是标准的微信中用户绑定
    public void userBoundWeixinAccess(UserboundPaymentOrder user);

    //查询当前数据是否存在：根据设备号和设备类型去查询非微信用户访问
    public int findExistNotWeixinUser(String deviceId, String deviceType,String requestOrderId);

    //插入数据：此时是标准的非微信中用户绑定，涉及：设备号，设备类型，userId
    public void userBounNotWeixinAccess(UserboundPaymentOrder user);

    //查询数据：是否存在当前用户，此时TemorderId为null和空
    public int findExistOrNotByTemorderId(String receiveUserName, String openId, String receiveAddress);

    //根据获取到的套餐code去查询套餐名称
    public String getPackageNameByPackageCode(String packageCode,String partnerCode);

    public String getPackageNameBypackages(String packages,String partnerCode);

    // 根据收到的openId去更新数据表，此时deviceId为null
    public void updateUserboundPaymentOrderNoCard(UserboundPaymentOrder paymentOrder);

    //标准微信用户访问支付上发，根据openid去更新表：orderId不为空，temOrderId为空，标准有卡流程
    public void updateUserboundWeixinPaymentOrder(UserboundPaymentOrder paymentOrder);

    //非微信用户访问支付上发
    public void updateUserboundNotWeixinPaymentOrder(UserboundPaymentOrder paymentOrder);

    //根据微信回调的订单号去数据库查询当前记录是不是已经记录
    public int findOrderIdByNotify(String out_trade_no);

    //根据根据微信回调的数据入库是否成功支付，根据paymentId这个id去数据插入支付结果，成功就将PayRst设为1；不插入就数据库默认0，成功就要通知，数据库就记1，不成功就不通知数据库会默认0
    public void updatePayRst(UserboundPaymentOrder paymentOrder);

    //根据微信回调的订单号去数据库查询对应的orderid
    public String queryOrderIdByPaymentId(String paymentId);

    //根据得到的订单号去查询当前记录的套餐code
    public String queryCodeByPaymentId(String paymentId);

    //标准的非微信用户oceanpay支付上发数据，更新数据表
    public void updateUserboundOceanPaymentOrder(UserboundPaymentOrder paymentOrder);

    //微信访问，根据openid获取deviceId和deviceType
    public List<UserboundPaymentOrder> getDeviceByOpenId(String openId);

    //去数据库查询哪些数据是需要去北京下真正的订单的
    public List<UserboundPaymentOrder> getNocardToOrderList();

    //去数据库更新一个id，为了关联
    public void updateChannelOrderID(UserboundPaymentOrder paymentOrder);

    //1，根据deviceId先去把支付订单orderId的表更新了
    public void updateOrderIdByDeviceId(UserboundPaymentOrder order);

    //更新当前订单是否需要再次被通知支付结果
    public void updateIsNotify(UserboundPaymentOrder paymentOrder);

    //去数据库查询一下有哪些记录是需要批量回传支付结果通知的
    public List<UserboundPaymentOrder> getNocardToNotifyList();

    //更新微信回复的订单id去数据库查询其他数据
    public UserboundPaymentOrder queryOrderByPaymentId(String paymentId);

    //将user_bound_payment_order_t转移到user_bound_payment_order_hist_t，每小时执行一次，转移的是未转移过的数据
    public void dataTransfer();

    //将user_bound_payment_order_t表中未支付成功的数据删除掉，当天的数据不删，每天晚上23点执行一次
    public void originalDataDelete();

    //根据paypal回传的订单id去数据库查询当前记录是否入库了
    public int findRecordByInvoice(String invoice);

    //根据订单号去更新回传的订单支付信息
    public void UpdatePaypalNotify(UserboundPaymentOrder order);

    //查询数据库中需要给渠道通知的数据
    public List<UserboundPaymentOrder> getChannelResultList();

    //同步完成之后就标识一样不用再同步
    public void updateIsChannelNotity(UserboundPaymentOrder paymentOrder);

    public List<UserboundPaymentOrder> getListToOpen();

    public void updateIsOpenNotify(UserboundPaymentOrder uOrder);

    public int findOrderIdAndDeviceId(String paymentOrderId, String orderId, String deviceId, String amount);

    public void InsertUserboundNotWeixinPaymentOrder(UserboundPaymentOrder paymentOrder);

    public int findCountByOrderNumber(String orderNumber);

    public void insertPaymentResultsPaypal(PaypalNotificationpaymentResults results);

    public int findCountByOrderId(String out_trade_no);

    public void InsertPaymentOrder(UserboundPaymentOrder paymentOrder);

    public int queryOrderByOrderId(String orderCode);

    public void UpdateRenewPackagesOrder(UserboundPaymentOrder paymentOrder);

    public List<UserboundPaymentOrder> getListToRenewPackage();

    public void updateIsRenew(UserboundPaymentOrder paymentOrder);

    public void InsertUserOrder(UserboundPaymentOrder user);
}
